import { onMounted } from 'vue'

export const useBackTop = () => {
  onMounted(() => {
    document.documentElement.scrollTop = 0
  })
}
// 监听页面滚动的距离
export const useBackPrev = (scrollDistance: { value: number }) => {
  onMounted(() => {
    // 监听滑动距离
    document.addEventListener('scroll', () => {
      console.log(document.documentElement.scrollTop)
      scrollDistance.value = document.documentElement.scrollTop
    })
  })
}
